package com.company.aop;

import java.io.Serializable;
import java.lang.reflect.Proxy;

/**
 * Created by ruoan on 2020/9/25 12:45
 */
public class JdkProxyMain {


    public static void main(String[] args) {
        Snake snake = new Snake();
        Class<?>[] interfaces = {Animal.class, Serializable.class};
        Animal a = (Animal)Proxy.newProxyInstance(JdkProxyMain.class.getClassLoader(), interfaces, new MyAnimalInvocationHandler(snake));
        //调用加强后的live方法
        a.live();


    }
}
